<template>
	<view>
		<view class="grid-container">
			<template v-if="operaList&&operaList.data.length">
				<view  @click="nav('/pages/opera/video/play')" class="grid-item" v-for="(item,index) in operaList.data" :key="index">
					<image :src="baseURL+'/'+item.logo_img" mode="aspectFill"></image>
					<view class="item-title">
						{{ item.name }}
					</view>
				</view>
			</template>
			<Empty v-else></Empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				baseURL:this.baseURL,
				operaList:null,
				category_id:null,
			}
		},
		onLoad(e) {
			if(e.type){
				uni.setNavigationBarTitle({
					title:e.type
				})
				this.getData()
			}
			
			if(e.category_id){
				this.category_id()
				this.getData()
			}
		},
		methods: {
			getData(){
				this.get('crud/list',{table:'opera', limit: 9999, category_id: this.category_id}).then(({code,paginate})=>{
					if(code==1){
						this.operaList=paginate
					}
				})
			}
		}
	}
</script>

<style lang="scss">
.grid-container {
	display: grid;
	grid-template-columns: 1fr 1fr;
	grid-row-gap: 24rpx;
	grid-column-gap: 24rpx;

	.grid-item {
		border-radius: 16rpx;
		overflow: hidden;
		box-shadow: 0rpx 4rpx 8rpx #dedede;

		image {
			width: 339rpx;
			height: 508rpx;
		}

		.item-title {
			font-size: 28rpx;
			color: #333333;
			font-weight: bold;
			padding: 0rpx 10rpx;
			line-height: 60rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
}
</style>
